package com.dense.kuiniu.floatcabinet.utils;

import android.animation.ObjectAnimator;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;

/**
 * @author Administrator
 * @date 2020/9/29
 */
public class DoorAnimator {
    public static void open(View view) {
        view.setPivotX(0);
        view.setPivotY(30);
        ObjectAnimator oa = ObjectAnimator.ofFloat(view, "rotationY",
                0f, -80f, -45f, -65f, -60f);
        oa.setDuration(2000);
        oa.setInterpolator(new DecelerateInterpolator());
        oa.start();
    }

    public static void close(View view) {
        ObjectAnimator oa = ObjectAnimator.ofFloat(view, "rotationY",
                -60f, 0f);
        oa.setDuration(500);
        oa.setInterpolator(new AccelerateInterpolator());
        oa.setDuration(1000);
        oa.start();
    }
} 